package servlet;

import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import java.io.IOException;

/**
 * @author 黄衡熙
 * @version 1.0
 */
public class LifeTwoServlet implements Servlet {
private ServletConfig config;
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        System.out.println("LifeTwoServlet.init");
        this.config=config;
    }

    @Override
    public ServletConfig getServletConfig() {
        return this.config;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("LifeTwoServlet.service");
        String encoding = getInitParameter("encoding");
        System.out.println("字符集为:"+encoding);
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {
        System.out.println("LifeTwoServlet.destroy");
    }
    public String getInitParameter(String name){return config.getInitParameter(name);}
}
